import request from '@/utils/request';
import { AxiosPromise } from 'axios';

/**
 * 类目列表
 */
export function getAssetClass(data:any) {
  return request({
    url: '/api/asset/class',
    method: 'get',
    params:data
  });
}

/**
 * 类目详情
 */
export function getAssetClassDetail(data:any) {
  return request({
    url: '/api/asset/class/' + data.id,
    method: 'get'
  });
}
/**
 * 编辑类目
 */
export function getAssetClassEdit(data:any) {
  return request({
    url: '/api/asset/class/' + data.id,
    method: 'put',
	data:data
  });
}
/**
 * 删除类目
 */
export function delAssetClass(data:any) {
  return request({
    url: '/api/asset/class/' + data.id,
    method: 'delete'
  });
}
/**
 * 新增类目
 */
export function getAssetClassAdd(data:any) {
  return request({
    url: '/api/asset/class',
    method: 'post',
    data:data
  });
}

/**
 * 新增字段
 */
export function getAssetFieldsAdd(data:any) {
  return request({
    url: '/api/asset/fields',
    method: 'post',
    data:data
  });
}
/**
 * 编辑字段
 */
export function getAssetFieldsEidt(data:any) {
  return request({
    url: '/api/asset/fields/'+data.id,
    method: 'put',
    data:data
  });
}
/**
 * 删除字段
 */
export function getAssetFieldsDel(data:any) {
  return request({
    url: '/api/asset/fields',
    method: 'delete',
    data:data
  });
}

/**
 * 字段详情
 */
export function getAssetFieldsDetail(data:any) {
  return request({
    url: '/api/asset/fields/'+ data.id,
    method: 'get'
  });
}

/**
 * 所有字段
 */
export function getAssetOptions(data:any) {
  return request({
    url: 'asset/options/'+ data.id,
    method: 'get'
  });
}

/**
 * 资产列表
 */
export function getAssetList(data:any) {
  return request({
    url: 'api/asset',
    method: 'get',
    params:data
  });
}
/**
 * 添加资产
 */
export function getAssetAdd(data:any) {
  return request({
    url: 'api/asset',
    method: 'post',
    data:data
  });
}
/**
 * 添加资产
 */
export function getAssetEidt(data:any) {
  return request({
    url: 'api/asset/'+data.id,
    method: 'put',
    data:data
  });
}

/**
 * 资产详情
 */
export function getAssetDetail(data:any) {
  return request({
    url: 'api/asset/'+data.id,
    method: 'get'
  });
}
/**
 * 资产详情
 */
export function getAssetDel(data:any) {
  return request({
    url: '/api/asset',
    method: 'delete',
    data:data
  });
}

/**
 * 导出
 */
export function exportAssetList(data:any) {
  return request({
    url: '/api/asset/export',
    method: 'get',
    params:data,
	 responseType: 'arraybuffer'
  });
}



